\(\int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx\) [1099]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 82 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=a x+\frac {3 b \text {arctanh}(\cos (c+d x))}{2 d}-\frac {3 b \cos (c+d x)}{2 d}+\frac {a \cot (c+d x)}{d}-\frac {b \cos (c+d x) \cot ^2(c+d x)}{2 d}-\frac {a \cot ^3(c+d x)}{3 d} \]

[Out]

a*x+3/2*b*arctanh(cos(d*x+c))/d-3/2*b*cos(d*x+c)/d+a*cot(d*x+c)/d-1/2*b*cos(d*x+c)*cot(d*x+c)^2/d-1/3*a*cot(d*
x+c)^3/d

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.368, Rules used = {2801, 2672, 294, 327, 212, 3554, 8} \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {a \cot ^3(c+d x)}{3 d}+\frac {a \cot (c+d x)}{d}+a x+\frac {3 b \text {arctanh}(\cos (c+d x))}{2 d}-\frac {3 b \cos (c+d x)}{2 d}-\frac {b \cos (c+d x) \cot ^2(c+d x)}{2 d} \]

[In]

Int[Cot[c + d*x]^4*(a + b*Sin[c + d*x]),x]

[Out]

a*x + (3*b*ArcTanh[Cos[c + d*x]])/(2*d) - (3*b*Cos[c + d*x])/(2*d) + (a*Cot[c + d*x])/d - (b*Cos[c + d*x]*Cot[
c + d*x]^2)/(2*d) - (a*Cot[c + d*x]^3)/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2801

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Int[Expan
dIntegrand[(g*Tan[e + f*x])^p, (a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2
, 0] && IGtQ[m, 0]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \int \left (b \cos (c+d x) \cot ^3(c+d x)+a \cot ^4(c+d x)\right ) \, dx \\ & = a \int \cot ^4(c+d x) \, dx+b \int \cos (c+d x) \cot ^3(c+d x) \, dx \\ & = -\frac {a \cot ^3(c+d x)}{3 d}-a \int \cot ^2(c+d x) \, dx-\frac {b \text {Subst}\left (\int \frac {x^4}{\left (1-x^2\right )^2} \, dx,x,\cos (c+d x)\right )}{d} \\ & = \frac {a \cot (c+d x)}{d}-\frac {b \cos (c+d x) \cot ^2(c+d x)}{2 d}-\frac {a \cot ^3(c+d x)}{3 d}+a \int 1 \, dx+\frac {(3 b) \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{2 d} \\ & = a x-\frac {3 b \cos (c+d x)}{2 d}+\frac {a \cot (c+d x)}{d}-\frac {b \cos (c+d x) \cot ^2(c+d x)}{2 d}-\frac {a \cot ^3(c+d x)}{3 d}+\frac {(3 b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{2 d} \\ & = a x+\frac {3 b \text {arctanh}(\cos (c+d x))}{2 d}-\frac {3 b \cos (c+d x)}{2 d}+\frac {a \cot (c+d x)}{d}-\frac {b \cos (c+d x) \cot ^2(c+d x)}{2 d}-\frac {a \cot ^3(c+d x)}{3 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.02 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.52 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {b \cos (c+d x)}{d}-\frac {b \csc ^2\left (\frac {1}{2} (c+d x)\right )}{8 d}-\frac {a \cot ^3(c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {3}{2},1,-\frac {1}{2},-\tan ^2(c+d x)\right )}{3 d}+\frac {3 b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}-\frac {3 b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {b \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d} \]

[In]

Integrate[Cot[c + d*x]^4*(a + b*Sin[c + d*x]),x]

[Out]

-((b*Cos[c + d*x])/d) - (b*Csc[(c + d*x)/2]^2)/(8*d) - (a*Cot[c + d*x]^3*Hypergeometric2F1[-3/2, 1, -1/2, -Tan
[c + d*x]^2])/(3*d) + (3*b*Log[Cos[(c + d*x)/2]])/(2*d) - (3*b*Log[Sin[(c + d*x)/2]])/(2*d) + (b*Sec[(c + d*x)
/2]^2)/(8*d)

Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.05

method result size
derivativedivides \(\frac {a \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+b \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) \(86\)
default \(\frac {a \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+b \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) \(86\)
parallelrisch \(\frac {-72 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b -2 a \left (\sec ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\csc ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \cos \left (3 d x +3 c \right )-9 b \left (\cos \left (d x +c \right )+\frac {3 \cos \left (2 d x +2 c \right )}{4}-\frac {\cos \left (3 d x +3 c \right )}{3}-\frac {3}{4}\right ) \left (\sec ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\csc ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+48 a x d}{48 d}\) \(114\)
risch \(a x -\frac {b \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}-\frac {b \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {12 i a \,{\mathrm e}^{4 i \left (d x +c \right )}+3 b \,{\mathrm e}^{5 i \left (d x +c \right )}-12 i a \,{\mathrm e}^{2 i \left (d x +c \right )}+8 i a -3 b \,{\mathrm e}^{i \left (d x +c \right )}}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {3 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}+\frac {3 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}\) \(144\)
norman \(\frac {a x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {a}{24 d}+\frac {7 a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}-\frac {7 a \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {a \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{8 d}+\frac {b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}-\frac {9 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {3 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}\) \(180\)

[In]

int(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(-1/3*cot(d*x+c)^3+cot(d*x+c)+d*x+c)+b*(-1/2/sin(d*x+c)^2*cos(d*x+c)^5-1/2*cos(d*x+c)^3-3/2*cos(d*x+c)-
3/2*ln(csc(d*x+c)-cot(d*x+c))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 160 vs. \(2 (74) = 148\).

Time = 0.29 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.95 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=\frac {16 \, a \cos \left (d x + c\right )^{3} + 9 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 12 \, a \cos \left (d x + c\right ) + 6 \, {\left (2 \, a d x \cos \left (d x + c\right )^{2} - 2 \, b \cos \left (d x + c\right )^{3} - 2 \, a d x + 3 \, b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(16*a*cos(d*x + c)^3 + 9*(b*cos(d*x + c)^2 - b)*log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 9*(b*cos(d*x +
 c)^2 - b)*log(-1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 12*a*cos(d*x + c) + 6*(2*a*d*x*cos(d*x + c)^2 - 2*b*cos
(d*x + c)^3 - 2*a*d*x + 3*b*cos(d*x + c))*sin(d*x + c))/((d*cos(d*x + c)^2 - d)*sin(d*x + c))

Sympy [F(-1)]

Timed out. \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=\text {Timed out} \]

[In]

integrate(cos(d*x+c)**4*csc(d*x+c)**4*(a+b*sin(d*x+c)),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.12 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=\frac {4 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} - 1}{\tan \left (d x + c\right )^{3}}\right )} a + 3 \, b {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - 4 \, \cos \left (d x + c\right ) + 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{12 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

1/12*(4*(3*d*x + 3*c + (3*tan(d*x + c)^2 - 1)/tan(d*x + c)^3)*a + 3*b*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) - 4
*cos(d*x + c) + 3*log(cos(d*x + c) + 1) - 3*log(cos(d*x + c) - 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.35 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.72 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 24 \, {\left (d x + c\right )} a - 36 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 15 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {48 \, b}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + \frac {66 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c)),x, algorithm="giac")

[Out]

1/24*(a*tan(1/2*d*x + 1/2*c)^3 + 3*b*tan(1/2*d*x + 1/2*c)^2 + 24*(d*x + c)*a - 36*b*log(abs(tan(1/2*d*x + 1/2*
c))) - 15*a*tan(1/2*d*x + 1/2*c) - 48*b/(tan(1/2*d*x + 1/2*c)^2 + 1) + (66*b*tan(1/2*d*x + 1/2*c)^3 + 15*a*tan
(1/2*d*x + 1/2*c)^2 - 3*b*tan(1/2*d*x + 1/2*c) - a)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 15.89 (sec) , antiderivative size = 225, normalized size of antiderivative = 2.74 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x)) \, dx=\frac {a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{24\,d}-\frac {-5\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+17\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-\frac {14\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{3}+b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {a}{3}}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}-\frac {5\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{8\,d}+\frac {b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}-\frac {3\,b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{2\,d}-\frac {2\,a\,\mathrm {atan}\left (\frac {4\,a^2}{4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,b\,a}-\frac {6\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,b\,a}\right )}{d} \]

[In]

int((cos(c + d*x)^4*(a + b*sin(c + d*x)))/sin(c + d*x)^4,x)

[Out]

(a*tan(c/2 + (d*x)/2)^3)/(24*d) - (a/3 + b*tan(c/2 + (d*x)/2) - (14*a*tan(c/2 + (d*x)/2)^2)/3 - 5*a*tan(c/2 +
(d*x)/2)^4 + 17*b*tan(c/2 + (d*x)/2)^3)/(d*(8*tan(c/2 + (d*x)/2)^3 + 8*tan(c/2 + (d*x)/2)^5)) - (5*a*tan(c/2 +
 (d*x)/2))/(8*d) + (b*tan(c/2 + (d*x)/2)^2)/(8*d) - (3*b*log(tan(c/2 + (d*x)/2)))/(2*d) - (2*a*atan((4*a^2)/(6
*a*b + 4*a^2*tan(c/2 + (d*x)/2)) - (6*a*b*tan(c/2 + (d*x)/2))/(6*a*b + 4*a^2*tan(c/2 + (d*x)/2))))/d